import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: '首页'
    // redirect: '/qrcode'
  },
  {
    path: '/pay-view',
    name: '普通支付',
    component: loadView('/payView/index.vue')
  },
  {
    path: '/member-pay',
    name: '会员支付',
    component: loadView('/memberPay/index.vue')
  },
  {
    path: '/pay-success',
    name: '支付成功页',
    component: loadView('/paySuccess/index.vue')
  },
  {
    path: '/register-member',
    name: '注册会员',
    component: loadView('/registerMember/index.vue')
  },
  {
    path: '/register-success',
    name: 'registerSuccess',
    component: loadView('/registerSuccess/index.vue')
  },
  {
    path: '/recharge',
    name: '充值',
    component: loadView('/recharge/index.vue')
  },
  {
    path: '/my-member',
    name: '我的会员',
    component: loadView('/myMember/index.vue')
  },
  {
    path: '/my-member-card',
    name: '我的会员卡',
    component: loadView('/myMemberCard/index.vue')
  },
  {
    path: '/qrcode',
    name: '扫码支付',
    component: loadView('/qrcode/index.vue')
  },
  {
    path: '/redirect',
    name: '我的',
    component: false
  },
  {
    path: '/mycoupon',
    name: '我的优惠券',
    component: loadView('/mycoupon/index.vue')
  },
  {
    path: '/usercardbill',
    name: '会员卡账单',
    component: loadView('/usercardbill/index.vue')
  },
  {
    path: '/recharge-details',
    name: '充值明细',
    component: loadView('/usercardbill/rechargeDetails/index.vue')
  },
  {
    path: '/consumption-details',
    name: '消费明细',
    component: loadView('/usercardbill/consumptionDetails/index.vue')
  },
  {
    path: '/myintegral',
    name: '我的积分',
    component: loadView('/myintegral/index.vue')
  }
]
function loadView(file) {
  return process.env.NODE_ENV === 'development' ? require('@/views' + file).default : () => import('@/views' + file)
}
const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
